package com.immediatus.graphics.contracts;

import com.immediatus.graphics.texture.TextureOptions;

import javax.microedition.khronos.opengles.GL10;
import java.io.IOException;

public interface ITexture{

    public int getWidth();

    public int getHeight();

    public int getHardwareTextureID();

    public boolean isLoadedToHardware();

    public void setLoadedToHardware(final boolean pLoadedToHardware);

    public boolean isUpdateOnHardwareNeeded();

    public void setUpdateOnHardwareNeeded(final boolean pUpdateOnHardwareNeeded);

    public void loadToHardware(final GL10 pGL) throws IOException;

    public void unloadFromHardware(final GL10 pGL);

    public void reloadToHardware(final GL10 pGL) throws IOException;

    public void bind(final GL10 pGL);

    public TextureOptions getTextureOptions();

    public boolean hasTextureStateListener();

    public ITextureStateListener getTextureStateListener();

    public static interface ITextureStateListener{
        public void onLoadedToHardware(final ITexture pTexture);

        public void onUnloadedFromHardware(final ITexture pTexture);

        public static class TextureStateAdapter<T extends ITextureAtlasSource> implements ITextureStateListener{
            @Override
            public void onLoadedToHardware(final ITexture pTexture){ }

            @Override
            public void onUnloadedFromHardware(final ITexture pTexture){ }
        }
    }
}